Xbasic

SYS_ID_ENUM Function

Syntax

Window_List as C = SYS_ID_ENUM()

Description

Return a list of top level windows.

Discussion

SYS_ID_ENUM() creates a CR-LF delimited character string that lists the windows currently available on your system.

Example

sys_id_enum() -> Start Menu 
 Norton AntiVirus

NetDDE Agent
Alpha Anywhere - [Code Editor]
Positioning
.
.
.

The following example tests to see if the Alpha Anywhere application is already open and prevents a second copy from being run.

dim list as C
dim recs as N
dim opens as N
dim win_name as C
list = upper(Sys_id_enum() )
recs = occurs(crlf() , list) + 1
dim progs[recs] as C
win_name = a5.window_title
n = lenwin_name?
opens = 0
progs.initialize(list)
for i = 1 to recs
    if left(alltrim(progs[i]), n) = win_name
        ui_msg_box("", "" + progs[i])
        opens = opens + 1
    end if
next
if (opens > 1) then
    ui_msg_box("Error", alltrim(win_name) + " Program already open. ", UI_STOP_SYMBOL)
    sys_focus_put(win_name)
    a5.close()
end if

Limitations

Desktop applications only.

See Also